<?php
class Vendor {
	var $CI;
	var $vendor_model;
	public function __construct() {
		$this->CI = & get_instance ();
		$this->CI->load->model ( "vendor/ven_vendor_model" );
		$this->vendor_model = $this->CI->ven_vendor_model;
	}
	public function insert_vendor($vendor_info) {
		$this->vendor_model->insert_vendor ( $vendor_info );
	}
	public function update_vendor($vendor, $vendor_id) {
		$this->vendor_model->update_vendor ( $vendor, $vendor_id );
	}
	public function query_vendor_list($user_id) {
		$start = intval ( $this->CI->input->get ( "per_page" ) );
		$limit = $this->CI->config->item ( "page_size" );
		return $this->vendor_model->query_vendor_list ( $user_id, $start, $limit );
	}
	public function query_vendor_num($user_id) {
		return $this->vendor_model->query_vendor_num ( $user_id );
	}
	public function get_vendor_info($vendor_id) {
		return $this->vendor_model->query_vendor_info ( $vendor_id );
	}
	public function get_vendors($region, $keyword = "") {
		return $this->vendor_model->get_vendors ( $region, $keyword );
	}
	public function search_vendor_list($user_id, $search) {
		$start = intval ( $this->CI->input->get ( "per_page" ) );
		$limit = $this->CI->config->item ( "page_size" );
		return $this->vendor_model->search_vendor_list ( $user_id, $start, $limit, $search );
	}
	public function search_vendor_num($user_id, $search) {
		return $this->vendor_model->search_vendor_num ( $user_id, $search );
	}
	public function query_vendor_by_name($vendor_name) {
		return $this->vendor_model->query_vendor_by_name ( $vendor_name );
	}
}